package com.cooldatasoft.domain.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cooldatasoft.domain.dao.DocumentDao;
import com.cooldatasoft.domain.model.Document;
import com.cooldatasoft.domain.model.DocumentType;
import com.cooldatasoft.domain.model.Project;
import com.cooldatasoft.domain.service.DocumentService;

@Service("documentService")
public class DocumentServiceImpl implements DocumentService {

	@Autowired
	private DocumentDao documentDao;
	
	@Override
	public Long insertDocument(Document doc) {
		return documentDao.insert(doc);
	}

	@Override
	public void updateDocument(Document doc) {
		documentDao.update(doc);
	}

	@Override
	public void deleteDocument(Long id) {
		documentDao.delete(id);
	}

	@Override
	public List<Document> getAllDocuments() {
		return documentDao.getAll();
	}

	@Override
	public Document getById(Long id) {
		return documentDao.getById(id);
	}

	@Override
	public Document getByProjectAndType(Project project, DocumentType type) {
		return documentDao.getByProjectAndType(project, type);
	}
	
	@Override
	public List<Document> getByProject(Project project) {
		return documentDao.getByProject(project);
	}
}
